﻿using System;
using System.Collections.Generic;
using System.Domain.Entity;
using System.Domain.IRepository;
using System.Text;
using Application.Infrastructure;

namespace System.Application
{
    /// <summary>
    ///组织表服务 
    /// </summary>	
    public class SysOrganizeService : BaseService_C_M<SysOrganizeEntity>
    {

        private readonly ISysOrganizeRepository _repository;
        public SysOrganizeService(ILog log, ISysOrganizeRepository repository) : this(log, repository, "")
        {
        }
        public SysOrganizeService(ILog log, ISysOrganizeRepository repository, string userId) : base(log, repository, userId)
        {
            _repository = repository;
        }


        public List<SysOrganizeEntity> GetCompanyList(string parentId)
        {
            try
            {
                return _repository.GetParentIdList(SysOrganizeTypeEnum.Company, parentId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public List<SysOrganizeEntity> GetDepartmentList(string parentId)
        {
            try
            {
                return _repository.GetParentIdList(SysOrganizeTypeEnum.Department, parentId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public List<SysOrganizeEntity> GetWorkList(string parentId)
        {
            try
            {
                return _repository.GetParentIdList(SysOrganizeTypeEnum.Work, parentId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
    }

}
